package com.eric.statemachinedemo.strategy;

import com.eric.statemachinedemo.constant.RmaStatusEnum;
import com.eric.statemachinedemo.model.request.ProcessRequestData;
import com.eric.statemachinedemo.model.response.ResponseResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class AbstractRmaProcessStrategy {

    private static final Logger LOGGER = LoggerFactory.getLogger(AbstractRmaProcessStrategy.class);

    /**
     * 代表的状态
     * @return
     */
    public abstract RmaStatusEnum status();

    /**
     * 校验
     * @param requestData
     * @return
     */
    public abstract ResponseResult validate(ProcessRequestData requestData);

    /**
     * 完成nextstep前动作
     * @param requestData
     */
    protected void beforeComplete(ProcessRequestData requestData){
        LOGGER.info("before complete...");
    }


    /**
     * 完成nextstep的动作
     * @param requestData
     */
    protected void complete(ProcessRequestData requestData){
        LOGGER.info("complete...");
    }

    /**
     * 完成nextstep后的动作
     * @param requestData
     */
    protected void afterComplete(ProcessRequestData requestData){
        LOGGER.info("after complete...");
    }
}
